<?php

namespace App\Library;


class Serialize
{
    public function Seria()
    {
        $u = new User();
        $u->name = "ethan";
        $s = serialize($u);
        $u2 = unserialize($s);
    }

}

class User
{
    public $name;
    public $id ;

    function __construct()
    {
        $this->id = uniqid();
    }

    function __sleep()
    {
        // TODO: Implement __sleep() method.
        return (array('name'));
    }

    function __wakeup()
    {
        // TODO: Implement __wakeup() method.
        $this->id = uniqid();
    }
}